package com.zxy.supplier_system.server.configuration

import com.zxy.supplier_system.server.utils.tencent.position.TencentWebPositionClient
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.context.properties.bind.ConstructorBinding
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

@Configuration
@EnableConfigurationProperties(TencentWebPositionProperties::class)
class TencentWebPositionConfiguration {

    @Bean
    fun tencentWebPositionClient(tencentWebPositionProperties: TencentWebPositionProperties): TencentWebPositionClient {
        return TencentWebPositionClient(tencentWebPositionProperties.key,tencentWebPositionProperties.secretKey)
    }

}

@ConfigurationProperties("tencent.web-position")
data class TencentWebPositionProperties @ConstructorBinding constructor(
    val key: String,
    val secretKey: String,
)